package com.jm.programming.lambda;

import java.util.function.IntBinaryOperator;

/**
 * @Description
 * @date 2022/6/29 7:46
 */
public class Test2 {
    public static void main(String[] args) {
        int retInt = calculateNum(new IntBinaryOperator() {
            @Override
            public int applyAsInt(int left, int right) {
                return left + right;
            }
        });
        System.out.println(retInt);

        int lamRet = calculateNum((int left, int right) -> {
            return left + right;
        });
        System.out.println(lamRet);
    }

    public static int calculateNum(IntBinaryOperator operator){
        int a = 10;
        int b = 20;
        return operator.applyAsInt(a, b);
    }

}
